import { createApp } from "vue";
import App from "./App.vue";

// import './assets/main.css'

// 导入element-plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";

// 导入路由
import router from "./router/index";

// 导入pinia
import pinia from "./store/index";
let menuList = JSON.parse(sessionStorage.getItem("menuList"));
import dealWithRoute from "@/router/dealWithRoute.js";
if (menuList) {
  dealWithRoute(menuList);
}
// 导入v-md-editor
import VueMarkdownEditor from "@kangc/v-md-editor";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import vuepressTheme from "@kangc/v-md-editor/lib/theme/vuepress.js";
import "@kangc/v-md-editor/lib/theme/style/vuepress.css";
import Prism from "prismjs";
import { ElMessage } from "element-plus";
VueMarkdownEditor.use(vuepressTheme, {
  Prism,
});
// 导入全局混入
import globalMixins from "./mixins/global";

import * as ElementPlusIconsVue from "@element-plus/icons-vue";

const app = createApp(App);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册
app.use(ElementPlus);
app.use(VueMarkdownEditor);
app.provide("message", ElMessage);
// 挂载路由
app.use(router);
// 挂载pinia
app.use(pinia);

// 注册混入
app.mixin(globalMixins);

app.mount("#app");
